<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%--js标签库jar包下的引入 使用c标签--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
    <title>欢迎页面</title>
    <script src="${pageContext.request.contextPath}/js/jquery.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
</head>
<body>
<h1>登录成功，欢迎您 ${sessionScope.user.name}</h1>
<h1>${requestScope.msg}</h1>
<a href="${pageContext.request.contextPath}/toAdd" class="btn btn-primary">添加用户</a>
<hr />

<%--页面显示用户列表--%>
<%--    tr>td*4  快捷键生成表格行数 --%>
<table class="table table-striped">
    <tr>
        <td>序号</td>
        <td>名字</td>
        <td>手机号</td>
        <td>注册时间</td>
        <td>操作</td>
    </tr>

    <c:forEach items="${requestScope.pageInfo.list}" var="user">
        <tr>
            <td>${user.id}</td>
            <td>${user.name}</td>
            <td>${user.phone}</td>
            <td><fmt:formatDate pattern="yyyy-MM-dd" value="${user.ctime}"/></td>
            <td><a href="#" class="btn btn-info">修改</a>&nbsp;<a href="#" class="btn btn-info">删除</a></td>
        </tr>
    </c:forEach>
</table>

<ul class="pager">
    <%--显示上一页--%>
    <c:if test="${requestScope.pageInfo.hasPreviousPage}">
        <li><a href="${pageContext.request.contextPath}/page/${num -1}">&lt;</a></li>
    </c:if>

    <c:forEach items="${requestScope.pageInfo.navigatepageNums}" var="num">
        <%-- 完成分页页码的超链接 --%>
        <li><a href="${pageContext.request.contextPath}/page/${num}">${num}</a></li>
    </c:forEach>

    <%--显示下一页--%>
    <c:if test="${requestScope.pageInfo.hasNextPage}">
        <li><a href="${pageContext.request.contextPath}/page/${num +1}">&gt;</a></li>
    </c:if>
</ul>

<hr/>
<c:forEach items="${requestScope.fileNames}" var="file">
    <a href="${pageContext.request.contextPath}/upload/${file}">${file}</a>&nbsp;&nbsp;
    <a href="${pageContext.request.contextPath}/download?filename=${file}">下载</a>
    <br/>
</c:forEach>
</body>
</html>


